export default {
  props: {
    //值
    value: {
      type: [Object]
    }, item: {
      type: Object, default: () => {
      }
    }
  },
  data() {
    return {
      showValue:'',
      cascaderValue: [],
      detailAddr: '',
      changeValue:{
        cascaderValue:[],
        detailAddr:''
      }
    }
  },
  watch: {
    cascaderValue: {
      handler: function (val, oldVal) {
          // if(val){
          //   this.cascaderValue = val.cascadeValue || []
          //   this.showValue= this.cascaderValue.join('/')
          //   this.detailAddr = val.detailAddr || ''

          // }
          // this.changeHandle()
        // const value = {cascadeValue: this.cascaderValue, detailAddr: this.detailAddr}
        // this.$emit('input', value)
        console.log(val,'val----watch')
        this.changeHandle()
       
      },
      deep:true,
      immediate: true
    },
    detailAddr: {
      handler: function (val, oldVal) {
        this.changeHandle()
      },
    },

  },
  mounted() {
    if(this.value && this.value.cascadeValue){
      this.cascaderValue=this.value.cascadeValue
    }
    if(this.value && this.value.detailAddr){
      this.detailAddr=this.value.detailAddr
    }
  },
  created() {

  },
  methods: {
    changeHandle(val) {
      if(this.cascaderValue.includes('济源示范区') || this.cascaderValue.includes('郑州航空港区')){
        if(this.cascaderValue.length == 2){
          this.cascaderValue.push('市本级')
        }
        
      }
      
      const value = {cascadeValue: this.cascaderValue, detailAddr: this.detailAddr}
      console.log(value,'value---222222')
      this.$emit('input', value)

    }
  }
}
